const log4js = require('log4js')
log4js.configure({
    appenders:{
        error: {
            type: 'file', //日志类型
            //日志输出位置，当目录文件或文件啊及不存在时自动创建
            category:'errLogger', //日志名称
            filename: __dirname + '/../logs/error.log/',
            maxLogSize: 104800, //文件最大存储空间
            backups: 100 //当文件内容超过文件存储空间时，备份文件的数量
        },
        response: {
            type:'dateFile',
            category: 'resLogger',
            filename: __dirname + '/../logs/responses/',
            pattern:'yyyy-MM-dd.log', //日志输出格式
            allwaysIncludePattern: true,
            maxLogSize:104800,
            backups:100
        }
    },
    categories: {
        error: {appenders: ['error'], level:'error'},
        response: {appenders:['response'], level: 'info'},
        default: {appenders:['response'], level: 'info'}
    },
    replaceConsole: true
})

module.exports = log4js